The image is for illustrative purposes only; please refer to the product data sheet for precise specifications.
| Part Number | SLD1602B-BW12 16x2 LCD Display B/W |
|---|---|
| Manufacturer |
|
| Description | The SLD1602B-BW1 is a standard 16x2 character LCD display module designed for embedded systems and industrial user interface applications. It features a 16-character × 2-line display format, providing clear and reliable text output for a wide range of electronic devices. Based on industry-standard controller architecture (HD44780 compatible), the module supports 4-bit and 8-bit parallel interface modes, allowing easy integration with microcontrollers such as Arduino, PIC, AVR, and other embedded platforms. This ensures high compatibility and simplified firmware development. The display utilizes STN LCD technology with LED backlight (typically blue background with white characters), offering good contrast and readability in various lighting conditions. It operates with a typical 5V supply voltage and includes a contrast adjustment pin for flexible visual tuning. Mechanically, the module follows the common 1602 LCD footprint, making it interchangeable with other standard 16x2 displays. Typical modules in this category have dimensions around 80 × 36 mm and are widely used due to their reliability and ease of integration . The SLD1602B-BW1 is commonly used in applications such as industrial control panels, measurement devices, home appliances, IoT systems, and educational electronics projects where simple text-based display output is required. Its low power consumption, robust structure, and wide compatibility make it a cost-effective and dependable display solution. |
| Product Group | LCD Display |
| MOQ | 500 pcs |
| SPQ | 25 pcs |
| Figure/Case | 80x36 LCD Module |
| Package | TRAY Pack |
| | |
| Ship From | Hong Kong |
| Shipment Way | DHL / Fedex / TNT / UPS / Others |
| Delivery Term | Ex-Works |
| Send RFQ | sales@signalhk.com |
/*=========================================================
STM8 + 16x2 LCD (4-bit mode) - COSMIC C
Example target: STM8S103F3 / STM8S003
=========================================================*/
#include "iostm8s103f3.h"
/* LCD control pins on Port D */
#define LCD_RS_PORT PD_ODR
#define LCD_RS_DDR PD_DDR
#define LCD_RS_CR1 PD_CR1
#define LCD_RS_PIN 2
#define LCD_E_PORT PD_ODR
#define LCD_E_DDR PD_DDR
#define LCD_E_CR1 PD_CR1
#define LCD_E_PIN 3
/* LCD data pins D4-D7 on Port C */
#define LCD_D4_PORT PC_ODR
#define LCD_D4_DDR PC_DDR
#define LCD_D4_CR1 PC_CR1
#define LCD_D4_PIN 4
#define LCD_D5_PORT PC_ODR
#define LCD_D5_DDR PC_DDR
#define LCD_D5_CR1 PC_CR1
#define LCD_D5_PIN 5
#define LCD_D6_PORT PC_ODR
#define LCD_D6_DDR PC_DDR
#define LCD_D6_CR1 PC_CR1
#define LCD_D6_PIN 6
#define LCD_D7_PORT PC_ODR
#define LCD_D7_DDR PC_DDR
#define LCD_D7_CR1 PC_CR1
#define LCD_D7_PIN 7
/* Small delay using NOP */
static void delay_cycles(volatile unsigned long n)
{
while (n--)
{
__asm("nop");
}
}
/* Approximate millisecond delay
Adjust loop count according to system clock */
static void delay_ms(unsigned int ms)
{
unsigned int i;
while (ms--)
{
for (i = 0; i < 1600; i++)
{
__asm("nop");
}
}
}
/* Configure LCD GPIO pins as push-pull outputs */
static void gpio_init(void)
{
/* RS and E as output push-pull */
LCD_RS_DDR |= (1 << LCD_RS_PIN);
LCD_RS_CR1 |= (1 << LCD_RS_PIN);
LCD_E_DDR |= (1 << LCD_E_PIN);
LCD_E_CR1 |= (1 << LCD_E_PIN);
/* D4-D7 as output push-pull */
LCD_D4_DDR |= (1 << LCD_D4_PIN);
LCD_D4_CR1 |= (1 << LCD_D4_PIN);
LCD_D5_DDR |= (1 << LCD_D5_PIN);
LCD_D5_CR1 |= (1 << LCD_D5_PIN);
LCD_D6_DDR |= (1 << LCD_D6_PIN);
LCD_D6_CR1 |= (1 << LCD_D6_PIN);
LCD_D7_DDR |= (1 << LCD_D7_PIN);
LCD_D7_CR1 |= (1 << LCD_D7_PIN);
}
/* Write one logic value to a port pin */
static void lcd_set_pin(volatile unsigned char *port, unsigned char pin, unsigned char val)
{
if (val)
*port |= (1 << pin);
else
*port &= ~(1 << pin);
}
/* Generate enable pulse */
static void lcd_pulse_enable(void)
{
lcd_set_pin(&LCD_E_PORT, LCD_E_PIN, 0);
delay_cycles(50);
lcd_set_pin(&LCD_E_PORT, LCD_E_PIN, 1);
delay_cycles(200);
lcd_set_pin(&LCD_E_PORT, LCD_E_PIN, 0);
delay_cycles(200);
}
/* Send 4-bit nibble to LCD */
static void lcd_write4(unsigned char nibble)
{
lcd_set_pin(&LCD_D4_PORT, LCD_D4_PIN, (nibble >> 0) & 0x01);
lcd_set_pin(&LCD_D5_PORT, LCD_D5_PIN, (nibble >> 1) & 0x01);
lcd_set_pin(&LCD_D6_PORT, LCD_D6_PIN, (nibble >> 2) & 0x01);
lcd_set_pin(&LCD_D7_PORT, LCD_D7_PIN, (nibble >> 3) & 0x01);
lcd_pulse_enable();
}
/* Send full byte in 4-bit mode
rs = 0 for command, 1 for data */
static void lcd_write_byte(unsigned char rs, unsigned char data)
{
lcd_set_pin(&LCD_RS_PORT, LCD_RS_PIN, rs);
/* Send high nibble first */
lcd_write4((data >> 4) & 0x0F);
/* Then low nibble */
lcd_write4(data & 0x0F);
delay_ms(2);
}
/* Send LCD command */
static void lcd_cmd(unsigned char cmd)
{
lcd_write_byte(0, cmd);
}
/* Send LCD data character */
static void lcd_data(unsigned char data)
{
lcd_write_byte(1, data);
}
/* Initialize LCD in 4-bit mode */
static void lcd_init(void)
{
delay_ms(40);
lcd_set_pin(&LCD_RS_PORT, LCD_RS_PIN, 0);
/* Standard 4-bit initialization sequence */
lcd_write4(0x03);
delay_ms(5);
lcd_write4(0x03);
delay_ms(2);
lcd_write4(0x03);
delay_ms(2);
lcd_write4(0x02); /* Switch to 4-bit mode */
delay_ms(2);
lcd_cmd(0x28); /* 4-bit, 2 lines, 5x8 font */
lcd_cmd(0x0C); /* Display ON, cursor OFF */
lcd_cmd(0x06); /* Entry mode set */
lcd_cmd(0x01); /* Clear display */
delay_ms(2);
}
/* Set cursor position */
static void lcd_gotoxy(unsigned char row, unsigned char col)
{
unsigned char addr;
if (row == 0)
addr = 0x80 + col;
else
addr = 0xC0 + col;
lcd_cmd(addr);
}
/* Print null-terminated string */
static void lcd_puts(const char *s)
{
while (*s)
{
lcd_data((unsigned char)*s);
s++;
}
}
void main(void)
{
/* Optional: set clock divider to full speed if supported */
CLK_CKDIVR = 0x00;
gpio_init();
lcd_init();
lcd_gotoxy(0, 0);
lcd_puts("STM8 COSMIC");
lcd_gotoxy(1, 0);
lcd_puts("LCD Test OK");
while (1)
{
/* Main loop */
}
}
/*=========================================================
STM32 + 16x2 LCD (4-bit mode) - COSMIC C
Example target: STM32F103C8
=========================================================*/
#include "stm32f10x.h"
/* LCD pin mapping on GPIOA */
#define LCD_RS_PIN 0
#define LCD_E_PIN 1
#define LCD_D4_PIN 4
#define LCD_D5_PIN 5
#define LCD_D6_PIN 6
#define LCD_D7_PIN 7
/* Small delay using NOP */
static void delay_cycles(volatile unsigned long n)
{
while (n--)
{
__asm("nop");
}
}
/* Approximate millisecond delay
Adjust according to MCU clock */
static void delay_ms(unsigned int ms)
{
while (ms--)
{
delay_cycles(8000);
}
}
/* Initialize GPIOA pins for LCD */
static void gpio_init(void)
{
/* Enable GPIOA peripheral clock */
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN;
/* Configure PA0, PA1, PA4, PA5, PA6, PA7
as output push-pull, 2 MHz */
GPIOA->CRL &= ~(
(0xF << (LCD_RS_PIN * 4))
| (0xF << (LCD_E_PIN * 4))
| (0xF << (LCD_D4_PIN * 4))
| (0xF << (LCD_D5_PIN * 4))
| (0xF << (LCD_D6_PIN * 4))
| (0xF << (LCD_D7_PIN * 4))
);
GPIOA->CRL |= (
(0x2 << (LCD_RS_PIN * 4))
| (0x2 << (LCD_E_PIN * 4))
| (0x2 << (LCD_D4_PIN * 4))
| (0x2 << (LCD_D5_PIN * 4))
| (0x2 << (LCD_D6_PIN * 4))
| (0x2 << (LCD_D7_PIN * 4))
);
}
/* Write one logic value to a GPIO pin */
static void lcd_pin_write(unsigned char pin, unsigned char val)
{
if (val)
GPIOA->BSRR = (1U << pin);
else
GPIOA->BRR = (1U << pin);
}
/* Generate enable pulse */
static void lcd_pulse_enable(void)
{
lcd_pin_write(LCD_E_PIN, 0);
delay_cycles(50);
lcd_pin_write(LCD_E_PIN, 1);
delay_cycles(300);
lcd_pin_write(LCD_E_PIN, 0);
delay_cycles(300);
}
/* Send 4-bit nibble to LCD */
static void lcd_write4(unsigned char nibble)
{
lcd_pin_write(LCD_D4_PIN, (nibble >> 0) & 0x01);
lcd_pin_write(LCD_D5_PIN, (nibble >> 1) & 0x01);
lcd_pin_write(LCD_D6_PIN, (nibble >> 2) & 0x01);
lcd_pin_write(LCD_D7_PIN, (nibble >> 3) & 0x01);
lcd_pulse_enable();
}
/* Send full byte in 4-bit mode
rs = 0 for command, 1 for data */
static void lcd_write_byte(unsigned char rs, unsigned char data)
{
lcd_pin_write(LCD_RS_PIN, rs);
/* Send high nibble first */
lcd_write4((data >> 4) & 0x0F);
/* Then low nibble */
lcd_write4(data & 0x0F);
delay_ms(2);
}
/* Send LCD command */
static void lcd_cmd(unsigned char cmd)
{
lcd_write_byte(0, cmd);
}
/* Send LCD data character */
static void lcd_data(unsigned char data)
{
lcd_write_byte(1, data);
}
/* Initialize LCD in 4-bit mode */
static void lcd_init(void)
{
delay_ms(40);
lcd_pin_write(LCD_RS_PIN, 0);
/* Standard 4-bit initialization sequence */
lcd_write4(0x03);
delay_ms(5);
lcd_write4(0x03);
delay_ms(2);
lcd_write4(0x03);
delay_ms(2);
lcd_write4(0x02);
delay_ms(2);
lcd_cmd(0x28); /* 4-bit, 2 lines, 5x8 font */
lcd_cmd(0x0C); /* Display ON, cursor OFF */
lcd_cmd(0x06); /* Entry mode set */
lcd_cmd(0x01); /* Clear display */
delay_ms(2);
}
/* Set cursor position */
static void lcd_gotoxy(unsigned char row, unsigned char col)
{
if (row == 0)
lcd_cmd(0x80 + col);
else
lcd_cmd(0xC0 + col);
}
/* Print null-terminated string */
static void lcd_puts(const char *s)
{
while (*s)
{
lcd_data((unsigned char)*s);
s++;
}
}
int main(void)
{
gpio_init();
lcd_init();
lcd_gotoxy(0, 0);
lcd_puts("STM32 COSMIC");
lcd_gotoxy(1, 0);
lcd_puts("LCD Test OK");
while (1)
{
/* Main loop */
}
}
REC001602AYPP5N00001 16x2 Character OLED Display Module 80x36 Yellow Black 4Bit. REC001602A is a COB Character 16x2 OLED Display m...
Room 1304, 13/F, Allways Centre, 468 Jaffe Road, Causeway Bay, Hong Kong. |